/*    */ package dm.jdbc.driver;
/*    */ 
/*    */ import dm.jdbc.dataConvertion.CnvtInfo;
/*    */ import dm.jdbc.dataConvertion.Convertion;
/*    */ import dm.jdbc.dbaccess.DmMsgSend;
/*    */ import dm.sql.DmdbDateTime;
/*    */ import dm.sql.DmdbTime;
/*    */ import java.sql.SQLException;
/*    */ import java.sql.Time;
/*    */ 
/*    */ public class DmTimeBinder extends DmBinder
/*    */ {
/*    */   public DmTimeBinder(DmdbPreparedStatement_bs pstmt)
/*    */   {
/* 15 */     super(pstmt);
/*    */   }
/*    */   
/*    */   void init() {
/* 19 */     this.recDType = 15;
/* 20 */     this.recPrec = 5;
/* 21 */     this.recScale = 0;
/*    */   }
/*    */   
/*    */   public int bindData(DmMsgSend msg, int irow, int icol, boolean forBatch) throws SQLException
/*    */   {
/* 26 */     Time x = ((Time[])this.pstmt.m_paramObjects[icol])[irow];
/* 27 */     CnvtInfo cnvtInfo = this.pstmt.connection.getCnvtInfo();
/* 28 */     String serverEncoding = cnvtInfo.getServerEncoding();
/*    */     
/* 30 */     byte[] ret = toDbBytes(x, this.destDType, this.destPrec, this.srcScale, 
/* 31 */       serverEncoding, cnvtInfo.getTimeZone(), cnvtInfo.getDbTz());
/*    */     
/* 33 */     return msg.appendBytesWithLen2(ret, 0, ret.length);
/*    */   }
/*    */   
/*    */   public static byte[] toDbBytes(Time x, int destDType, int destPrec, int srcScale, String serverEncoding, short ltz, short dbtz)
/*    */     throws SQLException
/*    */   {
/* 39 */     byte[] ret = null;
/* 40 */     switch (destDType) {
/*    */     case 15: 
/* 42 */       DmdbTime t = new DmdbTime(String.valueOf(x), srcScale);
/* 43 */       ret = Convertion.TimeToByteArray(t);
/* 44 */       break;
/*    */     case 16: 
/* 46 */       DmdbDateTime dt = new DmdbDateTime(x.toString(), srcScale, 
/* 47 */         1);
/* 48 */       ret = Convertion.TimeStampToByteArray(dt, destDType, srcScale, 
/* 49 */         dbtz, ltz);
/* 50 */       break;
/*    */     case 0: 
/*    */     case 1: 
/* 53 */       ret = Convertion.String_char_2CType(String.valueOf(x), destPrec, 
/* 54 */         destDType, serverEncoding);
/* 55 */       break;
/*    */     case 2: 
/*    */     case 19: 
/* 58 */       ret = Convertion.String_varchar_2CType(String.valueOf(x), destPrec, 
/* 59 */         destDType, serverEncoding);
/* 60 */       break;
/*    */     default: 
/* 62 */       dm.jdbc.dbaccess.DBError.throwSQLException(6007);
/*    */     }
/* 64 */     return ret;
/*    */   }
/*    */ }


/* Location:              D:\Program Files\DBMS_20150813\jdbc\Dm7JdbcDriver17.jar!\dm\jdbc\driver\DmTimeBinder.class
 * Java compiler version: 2 (46.0)
 * JD-Core Version:       0.7.1
 */